<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>父div加overflow样式解决父自适应高度</title>
        <style media="screen">
        .parent{
            width: 500px;
            padding: 30px;
            border: 1px solid #ddd;
            overflow: hidden; /* overflow 解决*/
        }
            .box{
                width: 200px;
                height: 200px;
            }
            .child-1{
                float: left;
                background-color: #ddd;
            }
            .child-2{
                float:right;
                background-color: red;
            }
        </style>
    </head>
    <body>
        <div class="parent">
            <div class="box child-1">

            </div>
            <div class="box child-2">

            </div>
        </div>
    </body>
</html>
